#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include "./tools/network/clientconnector.h"


QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();


private slots:
    void on_StartServerBtn_clicked();

    void on_TestConnectionBtn_clicked();


signals:
    // 告诉Service线程下线全部用户
    void logoutAllUsers();


private:
    Ui::MainWindow *ui;
    int PORT = 8080;
    QThread* tcpThread;
    QThread* handlerThread;
    QThread* dbServiceThread;
    ClientConnector* m_clientConnector;


    void InitThreads();

protected:
    void closeEvent(QCloseEvent *event) override;

};
#endif // MAINWINDOW_H
